﻿using System;
namespace Producers.Etoimik.Xtee.Riik.Ee.Producer.Etoimik {
    
    
    [global::Xtee.Core.Attributes.XmlTypeAttribute(Name="KOLAMenetlus", Namespace="http://producers.etoimik.xtee.riik.ee/producer/etoimik", Target=typeof(KOLAMenetlus))]
    public class KOLAMenetlusSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
        
        protected IKOLAMenetlus clazz;
        
        public KOLAMenetlusSerializer(IKOLAMenetlus clazz) {
            this.clazz = clazz;
        }
        
        public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
            base.WriteXml(Writer);
            if (clazz.Alustatud!=null) {
                Writer.WriteStartElement("Alustatud");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Alustatud))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.Kohtunik!=null) {
                Writer.WriteStartElement("Kohtunik");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Kohtunik))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.Kohus!=null) {
                Writer.WriteStartElement("Kohus");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Kohus))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.LahendiKP!=null) {
                Writer.WriteStartElement("LahendiKP");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "dateTime");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDateTime(((System.DateTime)(clazz.LahendiKP))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.MenetlusTeaveNimetus!=null) {
                Writer.WriteStartElement("MenetlusTeaveNimetus");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.MenetlusTeaveNimetus))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.MenetlusTeaveURL!=null) {
                Writer.WriteStartElement("MenetlusTeaveURL");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.MenetlusTeaveURL))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.TeiseAstmeStaatus!=null) {
                Writer.WriteStartElement("TeiseAstmeStaatus");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.TeiseAstmeStaatus))).ToString());
                Writer.WriteEndElement();
            }
        }
        
        public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
            base.ReadXml(Reader);
            if (Reader.LocalName=="Alustatud") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.Alustatud = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Alustatud")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="Kohtunik") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.Kohtunik = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Kohtunik")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="Kohus") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.Kohus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Kohus")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="LahendiKP") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.LahendiKP = new global::Xtee.Core.Schema.XsdDateTime(Reader.ReadElementString("LahendiKP")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="MenetlusTeaveNimetus") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.MenetlusTeaveNimetus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("MenetlusTeaveNimetus")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="MenetlusTeaveURL") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.MenetlusTeaveURL = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("MenetlusTeaveURL")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="TeiseAstmeStaatus") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.TeiseAstmeStaatus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("TeiseAstmeStaatus")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
        }
    }
}
